package com.corecloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corecloud.entity.SysSchool;
import com.corecloud.mapper.mysql.SysSchoolMapper;
import com.corecloud.service.SysSchoolService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author Shengyong-kb
* @description 针对表【sys_school】的数据库操作Service实现
* @createDate 2023-12-22 10:04:37
*/
@Service("SysSchoolService")
public class SysSchoolServiceImpl extends ServiceImpl<SysSchoolMapper, SysSchool>
    implements SysSchoolService{

    @Override
    public Page<SysSchool> getInfoByPage(Page page, QueryWrapper<SysSchool> qw) {
        return this.baseMapper.selectPage(page,qw);
    }

    @Override
    public boolean delete(Long id) {
        // TODO 查看当前学校id关联的是否由院系 专业 教师 学生 专家 如果有就不能删除
        boolean loop = true;
        // 删除学校
        this.baseMapper.deleteById(id);
        return loop;
    }

    @Transactional
    @Override
    public void batchSave(List<SysSchool> sysSchools) {
        this.saveBatch(sysSchools);
    }
}




